﻿package {
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.display.StageAlign;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	
	import org.tools.att.Att;	
	/**
	 * @author pptthh
	 */
	public class testApp extends Sprite
	{
		//	trace	examples:
		private	function	onTrace(...args):void{Att.send('onTrace',String(Object(this).constructor),args);}
 		private	function	eTrace(...args):void{Att.send('eTrace',String(Object(this).constructor),args);}
		private	function	wTrace(...args):void{Att.send('wTrace',String(Object(this).constructor),args);}
		private	function	hTrace(...args):void{Att.send('hTrace',String(Object(this).constructor),args);}
		private	function	gTrace(...args):void{Att.send('gTrace',String(Object(this).constructor),args);}
		private	function	bTrace(...args):void{Att.send('bTrace',String(Object(this).constructor),args);}
		private	function	yTrace(...args):void{Att.send('yTrace',String(Object(this).constructor),args);}
		private	function	mTrace(...args):void{Att.send('mTrace',String(Object(this).constructor),args);}
		private	function	cTrace(...args):void{Att.send('cTrace',String(Object(this).constructor),args);}
		private	function	sTrace(...args):void{Att.send('sTrace',String(Object(this).constructor),args);}
		//	init
		public	function	testApp()
		{
			if(stage is Stage)
			{
				stage.align=StageAlign.TOP_LEFT;
				stage.addChild(new TextField());
				TextField(stage.getChildAt(1)).width=350;
				TextField(stage.getChildAt(1)).text='move your mouse, click and wheel!';

				stage.addEventListener(MouseEvent.MOUSE_MOVE,	onMouse);
				stage.addEventListener(MouseEvent.CLICK,		onMouse);
				stage.addEventListener(MouseEvent.MOUSE_DOWN,	onMouse);
				stage.addEventListener(MouseEvent.MOUSE_UP,		onMouse);
				stage.addEventListener(MouseEvent.MOUSE_WHEEL,	onMouse);
				stage.addEventListener(MouseEvent.MOUSE_OUT,	onMouse);
				stage.addEventListener(MouseEvent.MOUSE_OVER,	onMouse);
				stage.addEventListener(MouseEvent.ROLL_OUT,		onMouse);
				stage.addEventListener(MouseEvent.ROLL_OVER,	onMouse);
			}
		}
		private	function	onMouse(e:MouseEvent):void
		{
			var txt:String='	mouse	X='+e.stageX+'	Y='+e.stageY+'	'+e.type;
			TextField(stage.getChildAt(1)).text='the traced text shold be: '+txt;
			
			switch(e.type)
			{
				case MouseEvent.MOUSE_MOVE	:	onTrace(txt);			return;
				case MouseEvent.CLICK		:	wTrace(txt);			return;
				case MouseEvent.MOUSE_DOWN	:	hTrace(txt);			return;
				case MouseEvent.MOUSE_UP	:	gTrace(txt);			return;
				case MouseEvent.MOUSE_WHEEL	:	bTrace(txt);			return;
				case MouseEvent.MOUSE_OUT	:	yTrace(txt);			return;
				case MouseEvent.MOUSE_OVER	:	mTrace(txt);			return;
				case MouseEvent.ROLL_OUT	:	cTrace(txt);			return;
				case MouseEvent.ROLL_OVER	:	sTrace(txt);			return;

				default:eTrace(txt);
			}

		}
	}
}
